#include <stdio.h>

int main() {
	int a[10],b[10],m,n,x,low=0,high=9,mid;
	for (m = 0; m < 10; m++)
		scanf("%d", &a[m]);
		scanf("%d", &x);
	for (m = 0; m < 10; m++) {
		for (n = 0; n < 10 - m; n++)
			if (a[n] > a[n + 1]) {
				a[n] = a[n] + a[n + 1];
				a[n + 1] = a[n] - a[n + 1];
				a[n] = a[n] - a[n + 1];
			}}
	do{
	mid=(low+high)/2;
	if(x==a[mid]) break;
	if	(x<a[mid])
	high=mid-1;
	else
	low=mid+1;}
	while(low<=high);
	if(low<=high)
		printf("%-4d,%d", a[mid],mid+1);
	else
	{n=0;
	while(x>a[n])
	{printf("%-4d", a[n]);
	n++;
	}}}
